#{extends 'CRUD/layout.html' /}
#{set title:messages.get('objects.analysiss') /}

<div id="crudShow" class="${type.name}">

    <h2 id="crudShowTitle">&{'analysis.edit'}</h2>

    <div class="objectForm">
    #{form action:@save(object._key()), enctype:'multipart/form-data'}
        #{crud.form fields:['analysisName', 'multyplier', 'analysisType', 'syndrome', 'analysisNorms', 'analysisSubTypes']}
        	#{crud.custom 'analysisNorms'}
	    		<label for="analysisNorms"><a href="@{AnalysisNorms.list()}" class="nonUnderlined">&{'objects.analysisnorms'}</a></label>
	    		%{analysisNorms = models.AnalysisNorm.find("byAnalysis", object).fetch()}%
	    		#{if analysisNorms != null && !analysisNorms.isEmpty() }
	    		<div class="list">
					#{list items:analysisNorms, as:'norm'}
						<li>
							<span id="${norm.analysisNormId}" class="hiddenLinks">
								@{AnalysisNorms.show(norm.analysisNormId)}
					        </span>
					        ${norm.description}
				        </li>
				    #{/list}
				</div>
	    		#{/if}
	    		#{else}
					&{'crud.list.empty'}	    		
	    		#{/else}
        	#{/crud.custom}
        	
        	#{crud.custom 'analysisSubTypes'}
	    		<label for="analysisSubTypes"><a href="@{AnalysisSubTypes.list()}" class="nonUnderlined">&{'objects.analysissubtypes'}</a></label>
	    		%{analysisSubTypes = models.AnalysisSubType.find("byAnalysis", object).fetch()}%
	    		#{if analysisSubTypes != null && !analysisSubTypes.isEmpty() }
	    		<div class="list">
					#{list items:analysisSubTypes, as:'subtype'}
						<li>
							<span id="${subtype.analysisSubTypeId}" class="hiddenLinks">
								@{AnalysisSubTypes.show(subtype.analysisSubTypeId)}
					        </span>
					        ${subtype.analysisSubtypeName}
				        </li>
				    #{/list}
				</div>
	    		#{/if}
	    		#{else}
					&{'crud.list.empty'}	    		
	    		#{/else}
        	#{/crud.custom}
        #{/crud.form}
        <p class="crudButtons">
            <input type="submit" name="_save" value="&{'crud.save', type.modelName}" />
            <input type="submit" name="_saveAndContinue" value="&{'crud.saveAndContinue', type.modelName}" />
        </p>
    #{/form}
    </div>

    #{form @delete(object._key())}
        <p class="crudDelete">
            <input type="submit" value="&{'analysis.delete'}" onclick="return confirm('&{'analysis.delete'}')"/>
        </p>
    #{/form}

</div>